<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>课室管理系统</title>
<%@include file="../common/header.jsp"%>
	<script type="text/javascript">
		$(function (){
			$(".saveOrderBtn").click(function (){
				var name = $(this).parent().parent().find("td:first").text();
				return confirm("您是否要预订【"+ name +"】吗？");
			});
		});
	</script>
</head>
<body>

<div id="header">
	<img class="logo_img" alt="" src="static/img/logo.png" >
	<span class="wel_word">图书管理系统</span>
	<div>
		<c:choose>
			<c:when	test="${sessionScope.student != null}">
				<span>欢迎<span class="um_span">${sessionScope.student.username}</span>光临图书管理系统</span>
				<a href="orderServlet?action=myPage">我的预订</a>
				<a href="studentServlet?action=logout">注销</a>&nbsp;&nbsp;
			</c:when>
			<c:when	test="${sessionScope.manager != null}">
				<span>欢迎<span class="um_span">${sessionScope.manager.username}</span>光临图书管理系统</span>
				<a href="pages/manager/manager.jsp">后台管理</a>
				<a href="studentServlet?action=logout">注销</a>&nbsp;&nbsp;
			</c:when>
			<c:otherwise>
				<a href="pages/user/login.jsp">登录</a> |
				<a href="pages/user/regist.jsp">管理员登陆</a> &nbsp;&nbsp;
			</c:otherwise>
		</c:choose>
	</div>
</div>
	<div id="main">
		<div id="book">
<%--			<div class="book_cond">--%>
<%--				<form action="" method="get">--%>
<%--					<input type="text" style="width:200px; height: 30px">--%>
<%--					<input type="submit" value="查询" />--%>
<%--				</form>--%>
<%--			</div>--%>
			<table>
				<tr>
					<td>课室名称</td>
					<td>容量</td>
					<td>多媒体情况</td>
					<td>类型</td>
					<td>状态</td>
					<td>操作</td>
				</tr>
				<c:forEach items="${requestScope.page.items}" var="classroom">
				<tr>
					<td>${classroom.name}</td>
					<td>${classroom.capacity}</td>
					<td>
                        <c:if test="${classroom.medium==0}">无</c:if>
                        <c:if test="${classroom.medium==1}">有</c:if>
                    </td>
					<td>
                        <c:if test="${classroom.type==0}">普通教室</c:if>
                        <c:if test="${classroom.type==1}">阶梯教室</c:if>
                    </td>
					<td>
						<c:if test="${classroom.status==0}">空闲中</c:if>
						<c:if test="${classroom.status==1}">已借出</c:if>
						<c:if test="${classroom.status==2}">使用中</c:if>
					</td>
					<c:if test="${classroom.status>0}">
					<td>预订</td>
					</c:if>
					<c:if test="${classroom.status==0}">
					<td><a class="saveOrderBtn" href="orderServlet?action=createOrder&classroomId=${classroom.id}&studentId=${sessionScope.student.studentId}&pageNo=${requestScope.page.pageNo}">
						预订
						</a>
					</td>
					</c:if>
				</tr>
				</c:forEach>

			</table>

            <%@include file="../common/page_nav.jsp"%>
	
	</div>
	</div>
	<%@include file="../common/footer.jsp"%>
</body>
</html>